SHELL := /bin/bash

INS_PATH=`pwd`/install
INC_PATH=${INS_PATH}/include
LIB_PATH=${INS_PATH}/lib
BIN_PATH=${INS_PATH}/bin
LIBNAME=clientds18b20

SQL_LIB=`pwd`/../sqlite3/install/lib/
SQL_PATH=`pwd`/../sqlite3/install/include/

CC=gcc

all:
	mkdir -p ${INS_PATH}/{bin,include,lib}
	make -C src
	${CC} main.c -o main -I${INC_PATH} -I${SQL_PATH} -L${LIB_PATH} -l${LIBNAME} ${SQL_LIB}/libsqlite3.a -lpthread -ldl -lm
	make install

install:main
	mv main ${BIN_PATH}

clean:
	rm -f ${LIB_PATH} lib${LIBNAME}.*
	
